package co.yixiang.modules.quartz.task;

import co.yixiang.aop.log.Log;
import co.yixiang.modules.shop.service.YxStoreOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author Walert
 * @date 2018-12-25
 */
@Component
@Slf4j
public class OrderTask {

    private final YxStoreOrderService storeOrderService;

    public OrderTask(YxStoreOrderService storeOrderService) {
        this.storeOrderService = storeOrderService;
    }

    public void run(){
        storeOrderService.changeStatusByTask(0);
    }

    public void run2(String timeStr){
        Integer time = Integer.valueOf(timeStr);
        storeOrderService.changeStatusByTask(time);
        log.info("{}分钟过期用户订单-执行成功，参数为： {}" , timeStr, timeStr);
    }

    public void run3(String timeStr){
        Integer time = Integer.valueOf(timeStr);
        storeOrderService.confirmOrderByTask(time);
        log.info("确认收货用户订单-执行成功，参数为： {}" , timeStr);

    }

    public void run4(String timeStr){
        Integer time = Integer.valueOf(timeStr);
        storeOrderService.getPayInfoTask();
        log.info("获取用户订单支付信息-执行成功，参数为： {}" , timeStr);
    }
}
